// shopPages/clothYe/cloth.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    indicatorDots: false,
    autoplay: true,
    interval: 3000,
    duration: 1000,
    circular: true,
    dots_f:false,
    imgUrls: [],
    huo1_src: '',
    home:[],
    s_list1:[],
    currentSwiper:0,
    currentSwiper1: 0,
  },
  // 轮播指示点
  swiperChange: function (e) {
    this.setData({
      currentSwiper1: e.detail.current,
    })
  },
  swiperchange: function (e) {
    this.setData({
      currentSwiper: e.detail.current,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    // console.log(options.title);
    // if (options.title != undefined) {
    //   wx.setNavigationBarTitle({
    //     title: options.title
    //   })
    // }
    that.setData({
      p_cat_id: options.cat_id
    });
    console.log(options.cat_id);
    var url2 = "/mall/mallIndexSecond"
    var params2 = {
      pid: options.cat_id,
      city_code: app.globalData.currentCode
    };
    console.log(params2);
    wx.showLoading({
      title: '玩命加载中',
    })
    app.HttpPostSend(url2, params2, function (res) {
      wx.hideLoading();
      if (res.msg !== "success") {
        app.showTipMsg(res.msg);
      } else {
        console.log(res)
        // console.log('图片' + res.banner_list.data.img)
        that.setData({
          huo1_src: res.act_img ,
          imgUrls: res.banner_list,
          grids: res.cat_list,
          home: res.new_list.lists.data,
          zhinen: res.hot_list.lists.data,
          // s_list: res.recommend_list.lists.data,
          // s_list1: res.season_list.lists.data
        })
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {

  // },
  toGoodsList: function (e) {
    var cat_id = e.currentTarget.dataset.cat_id;
    // console.log(cat_id);
    wx.navigateTo({
      url: '../../shopPages/shoplist/shoplist?p_cat_id=' + cat_id,
    })
    // wx.navigateTo({
    //   url: '../../shopPages/storeList/storeList?cat_id=' + cat_id,
    // })
  },
  toMore: function (e) {
    var param = e.currentTarget.dataset.param;
    wx.navigateTo({
      url: '../../shopPages/shoplist/shoplist' + param,
    })
  },
  toGoodsDetail: function (e) {
    wx.navigateTo({
      url: e.currentTarget.dataset.url
    })
  },
  menuAction: function (e) {

  },
  toGoodsDetail_: function (e) {
    wx.navigateTo({
      url: "/pages/goodsDetail/goodsDetail?id=" + e.currentTarget.dataset.id
    })
  }
})